/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package savet.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.openswing.swing.message.receive.java.ValueObject;
import savet.entidades.atributos.Legenda;

/**
 *
 * @author Rafael
 */
@Entity
@Table(name = "tblementario")
@NamedQueries({
    @NamedQuery(name = "Ementa.findAll", query = "SELECT e FROM Ementa e"),
    @NamedQuery(name = "Ementa.findByEmenta", query = "SELECT e FROM Ementa e WHERE e.ementa = :ementa"),
    @NamedQuery(name = "Ementa.findByGrupo", query = "SELECT e FROM Ementa e WHERE e.grupo = :grupo"),
    @NamedQuery(name = "Ementa.findByCapitulacao", query = "SELECT e FROM Ementa e WHERE e.capitulacao = :capitulacao"),
    @NamedQuery(name = "Ementa.findByPerCapita", query = "SELECT e FROM Ementa e WHERE e.perCapita = :perCapita"),
    @NamedQuery(name = "Ementa.findByGradacao", query = "SELECT e FROM Ementa e WHERE e.gradacao = :gradacao"),
    @NamedQuery(name = "Ementa.findByTipo", query = "SELECT e FROM Ementa e WHERE e.tipo = :tipo")})
public class Ementa implements ValueObject, Serializable {
    private static final long serialVersionUID = 3L;

    @Id
    @Basic(optional = false)
    @Column(name = "Ementa")
    private String ementa;


    @Column(name = "Grupo")
    private String grupo;


    @Lob
    @Column(name = "Descricao")
    private String descricao;


    @Column(name = "Capitulacao")
    private String capitulacao;

    @Lob
    @Column(name = "Nota")
    private String nota;

    @Column(name = "PerCapita")
    private String perCapita;

    @Column(name = "Gradacao")
    private String gradacao;

    @Column(name = "Tipo")
    private String tipo;

    @OneToMany(mappedBy = "ementa")
    private List<Legenda> legendas;

    public Ementa() {
    }

    public Ementa(String ementa) {
        this.ementa = ementa;
    }

    public String getEmenta() {
        return ementa;
    }

    public void setEmenta(String ementa) {
        this.ementa = ementa;
    }

    public String getGrupo() {
        return grupo;
    }

    public void setGrupo(String grupo) {
        this.grupo = grupo;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public String getCapitulacao() {
        return capitulacao;
    }

    public void setCapitulacao(String capitulacao) {
        this.capitulacao = capitulacao;
    }

    public String getNota() {
        return nota;
    }

    public void setNota(String nota) {
        this.nota = nota;
    }

    public String getPerCapita() {
        return perCapita;
    }

    public void setPerCapita(String perCapita) {
        this.perCapita = perCapita;
    }

    public String getGradacao() {
        return gradacao;
    }

    public void setGradacao(String gradacao) {
        this.gradacao = gradacao;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ementa != null ? ementa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ementa)) {
            return false;
        }
        Ementa other = (Ementa) object;
        if ((this.ementa == null && other.ementa != null) || (this.ementa != null && !this.ementa.equals(other.ementa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "savet.entidades.Ementa[ementa=" + ementa + "]";
    }

     @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
